function funcModNew=handleChange(add2Func,funcMod,parVec,solveOpt,addSol)
% =========================================================================
% function funcModNew=handleChange(add2Func,funcMod,parVec,solveOpt,addSol)
% Given the string a*dd2Func* to add to the function handle *funcModel*, 
% solve the model with *parVec*, *solveOpt* and
% *addSol*, and check that the variance of the observables matches that of
% the function handle *funcModNew=funcModel + add2Handle* 
% A. Justiniano Jan 16 2012 
% =========================================================================
if exist('add2Func','var')==1 && ~isempty(add2Func)
    dispaj('Switching function handle from ',func2str(funcMod));
    dispaj('to  ',[func2str(funcMod),add2Func]);
    disp(' ');
    disp('Verifying solutions match...');
    pause(0.25);
    [junk,junk,difvar,difc]=checkmodels_lmj(funcMod,...
        str2func([func2str(funcMod),add2Func]),parVec,solveOpt,addSol);
    if difvar < 1e-7;
        disp('Solutions identical')
    else
        disp('Solutions do not match')
    end
    if difc < 1e-10;
        disp('Constants identical');
    else
        disp('Constants do not match');
    end
    clear var1 var2 difvar difc
    funcModNew=str2func([func2str(funcMod),add2Func]);
    disp('Changed funcMod handle')
end
